﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using GrainManage.Server.Factory;
using GrainManage.Entities.District;
using GrainManage.Entities;
using GrainManage.Server.Business;

namespace GrainManage.Server.Controllers
{
    public class DistrictController : BaseController
    {
        private readonly DistrictBusiness business = new DistrictBusiness();

        public string Index()
        {
            return GetInfo(this, business);
        }

        public string Schema()
        {
            return GetSchema(this, business);
        }

        //************************************************POST************************************************
        [HttpPost]
        public ActionResult GetByID(InputGetByID input)
        {
            var result = business.GetByID(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult GetByName(InputGetByName input)
        {
            var result = business.GetByName(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult GetFatherName(InputGetFatherName input)
        {
            var result = business.GetFatherName(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult GetChildName(InputGetChildName input)
        {
            var result = business.GetChildName(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult GetUpwardDistrict(InputGetUpwardDistrict input)
        {
            var result = business.GetUpwardDistrict(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult GetChildDistrict(InputGetDownwardDistrict input)
        {
            var result = business.GetDownwardDistrict(input);
            return Json(result);
        }


    }
}
